package com.xxcxcxcx.xc_moremob.common.registers;
import com.xxcxcxcx.xc_moremob.Main;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.arrow_zombie.ArrowZombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.arrow_zombie.ArrowZombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.crawling_zombie.CrawlingZombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.crawling_zombie.CrawlingZombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk.huskEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk.huskRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk_rocket.husk_rocketEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk_rocket.husk_rocketRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.relicmob.husk_rocket_warts.husk_rocket_wartsEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.relicmob.husk_rocket_warts.husk_rocket_wartsRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.swampmob.drowned.DrownedEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.swampmob.drowned.DrownedRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.farm_zombie.FarmZombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.farm_zombie.FarmZombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk_arrow.husk_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.husk_arrow.husk_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.jinny_timi.JinnyTimiEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.jinny_timi.JinnyTimiRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.rocket_zombie.RocketZombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.rocket_zombie.RocketZombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.bossmob.wizard.wizardEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.bossmob.wizard.wizardRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.yeti_zombie.yeti_zombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.yeti_zombie.yeti_zombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.zombie.zombieEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.basemob.zombie.zombieRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_awful.zombie_awfulEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_awful.zombie_awfulRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_awful_arrow.zombie_awful_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_awful_arrow.zombie_awful_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_blind.zombie_blindEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_blind.zombie_blindRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_blind_arrow.zombie_blind_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_blind_arrow.zombie_blind_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_broken.zombie_brokenEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_broken.zombie_brokenRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_digslow.zombie_digslowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_digslow.zombie_digslowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_digslow_arrow.zombie_digslow_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_digslow_arrow.zombie_digslow_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.zombie_miner.zombie_minerEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.zombie_miner.zombie_minerRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.zombie_miner_arrow.zombie_miner_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.desertmob.zombie_miner_arrow.zombie_miner_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north.zombie_northEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north.zombie_northRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north_arrow.zombie_north_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north_arrow.zombie_north_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north_rocket.zombie_north_rocketEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.zombie_north_rocket.zombie_north_rocketRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_swamp.zombie_swampEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_swamp.zombie_swampRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_swamp_arrow.zombie_swamp_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.savannamob.zombie_swamp_arrow.zombie_swamp_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_wither.zombie_witherEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_wither.zombie_witherRender;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_wither_arrow.zombie_wither_arrowEntity;
import com.xxcxcxcx.xc_moremob.common.entities.common_mob.forestmob.zombie_wither_arrow.zombie_wither_arrowRender;
import com.xxcxcxcx.xc_moremob.common.entities.monster.realization.*;
import com.xxcxcxcx.xc_moremob.common.entities.monster.render.*;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;

import static com.xxcxcxcx.xc_moremob.common.registers.EntityRegister.*;

@Mod.EventBusSubscriber(modid = Main.MOD_ID,bus = Mod.EventBusSubscriber.Bus.MOD)
public class ClientModEventSubscriber
{
    //将所有的生物的皮肤贴图信息写在这个函数里，有几个写几个
    @SubscribeEvent
    public static void onRegisterLayers(EntityRenderersEvent.RegisterLayerDefinitions event) {
//        event.registerLayerDefinition(testModel.LAYER_LOCATION, testModel::createBodyLayer);
//        event.registerLayerDefinition(ZombieChangeModel.LAYER_LOCATION, ZombieChangeModel::createBodyLayer);
//        event.registerLayerDefinition(ZombieChangeModel.LAYER_LOCATION_IN, ZombieChangeModel::createINLayer);
//        event.registerLayerDefinition(ZombieChangeModel.LAYER_LOCATION_OUT, ZombieChangeModel::createOUTLayer);
//        event.registerLayerDefinition(zombie_north_rocketModel.LAYER_LOCATION, zombie_north_rocketModel::createBodyLayer);
    }
    @SubscribeEvent
    public static void init(FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {
            SpawnPlacements.register(MELEE_BASIC.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(REMOTE_BASIC.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(WITCH_BASIC.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(FLY_MELEE_BASIC.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(Farm_Zombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(Arrow_Zombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(Rocket_Zombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(Drowned.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(CrawlingZombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(husk_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(yeti_zombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_broken.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_miner.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_miner_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_north_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_north_rocket.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(wizard.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_north.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_awful.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_digslow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_blind.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_wither.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_swamp.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_awful_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_digslow_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_blind_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_wither_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie_swamp_arrow.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(zombie.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(husk_rocket.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(husk.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
            SpawnPlacements.register(husk_rocket_warts.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules);
        });
    }

    //将所有的生物的渲染信息写在这个函数里，有几个写几个
    @SubscribeEvent
    public static void onRegisterRenderer(EntityRenderersEvent.RegisterRenderers event) {
        event.registerEntityRenderer(MELEE_BASIC.get(), MeleeBasicRender::new);
        event.registerEntityRenderer(EntityRegister.FLY_REMOTE_BASIC.get(), FlyRemoteBasicRender::new);
        event.registerEntityRenderer(REMOTE_BASIC.get(), RemoteBasicRender::new);
        event.registerEntityRenderer(WITCH_BASIC.get(), WitchBasicRender::new);
        event.registerEntityRenderer(EntityRegister.FLY_MELEE_BASIC.get(), FlyMeleeBasicRender::new);
        event.registerEntityRenderer(EntityRegister.SKILL_BASIC.get(), SkillBasicRender::new);
        event.registerEntityRenderer(EntityRegister.Farm_Zombie.get(), FarmZombieRender::new);
        event.registerEntityRenderer(EntityRegister.Arrow_Zombie.get(), ArrowZombieRender::new);
        event.registerEntityRenderer(EntityRegister.Rocket_Zombie.get(), RocketZombieRender::new);
        event.registerEntityRenderer(EntityRegister.Jinny_Timi.get(), JinnyTimiRender::new);
        event.registerEntityRenderer(EntityRegister.Drowned.get(), DrownedRender::new);
        event.registerEntityRenderer(EntityRegister.CrawlingZombie.get(), CrawlingZombieRender::new);
        event.registerEntityRenderer(EntityRegister.husk_arrow.get(), husk_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.yeti_zombie.get(), yeti_zombieRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_broken.get(), zombie_brokenRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_miner.get(), zombie_minerRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_miner_arrow.get(), zombie_miner_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_north_arrow.get(), zombie_north_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_north_rocket.get(), zombie_north_rocketRender::new);
        event.registerEntityRenderer(EntityRegister.wizard.get(), wizardRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_north.get(), zombie_northRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_awful.get(), zombie_awfulRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_blind.get(), zombie_blindRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_digslow.get(), zombie_digslowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_swamp.get(), zombie_swampRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_wither.get(), zombie_witherRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_awful_arrow.get(), zombie_awful_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_blind_arrow.get(), zombie_blind_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_digslow_arrow.get(), zombie_digslow_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_swamp_arrow.get(), zombie_swamp_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie_wither_arrow.get(), zombie_wither_arrowRender::new);
        event.registerEntityRenderer(EntityRegister.zombie.get(), zombieRender::new);
        event.registerEntityRenderer(EntityRegister.husk_rocket.get(), husk_rocketRender::new);
        event.registerEntityRenderer(EntityRegister.husk.get(), huskRender::new);
        event.registerEntityRenderer(EntityRegister.husk_rocket_warts.get(), husk_rocket_wartsRender::new);

    }
    //将所有的生物的属性信息写在这个函数里，有几个写几个
    @SubscribeEvent
    public static void onAttributeCreate(EntityAttributeCreationEvent event) {
        event.put(MELEE_BASIC.get(), MeleeBasicEntity.prepareAttributes().build());
        event.put(EntityRegister.FLY_REMOTE_BASIC.get(), FlyRemoteBasicEntity.createAttributes().build());
        event.put(REMOTE_BASIC.get(), RemoteBasicEntity.prepareAttributes().build());
        event.put(WITCH_BASIC.get(), WitchBasicEntity.prepareAttributes().build());
        event.put(EntityRegister.FLY_MELEE_BASIC.get(), FlyMeleeBasicEntity.prepareAttributes().build());
        event.put(EntityRegister.SKILL_BASIC.get(), SkillBasicEntity.prepareAttributes().build());
        event.put(EntityRegister.Farm_Zombie.get(), FarmZombieEntity.prepareAttributes().build());
        event.put(EntityRegister.Arrow_Zombie.get(), ArrowZombieEntity.prepareAttributes().build());
        event.put(EntityRegister.Rocket_Zombie.get(), RocketZombieEntity.prepareAttributes().build());
        event.put(EntityRegister.Jinny_Timi.get(), JinnyTimiEntity.prepareAttributes().build());
        event.put(EntityRegister.Drowned.get(), DrownedEntity.prepareAttributes().build());
        event.put(EntityRegister.CrawlingZombie.get(), CrawlingZombieEntity.prepareAttributes().build());
        event.put(EntityRegister.husk_arrow.get(), husk_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.yeti_zombie.get(), yeti_zombieEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_broken.get(), zombie_brokenEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_miner.get(), zombie_minerEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_miner_arrow.get(), zombie_miner_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_north_arrow.get(), zombie_north_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_north_rocket.get(), zombie_north_rocketEntity.prepareAttributes().build());
        event.put(EntityRegister.wizard.get(), wizardEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_north.get(), zombie_northEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_awful.get(), zombie_awfulEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_blind.get(), zombie_blindEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_digslow.get(), zombie_digslowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_swamp.get(), zombie_swampEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_wither.get(), zombie_witherEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_awful_arrow.get(), zombie_awful_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_blind_arrow.get(), zombie_blind_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_digslow_arrow.get(), zombie_digslow_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_swamp_arrow.get(), zombie_swamp_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie_wither_arrow.get(), zombie_wither_arrowEntity.prepareAttributes().build());
        event.put(EntityRegister.zombie.get(), zombieEntity.prepareAttributes().build());
        event.put(EntityRegister.husk_rocket.get(), husk_rocketEntity.prepareAttributes().build());
        event.put(EntityRegister.husk.get(), huskEntity.prepareAttributes().build());
        event.put(EntityRegister.husk_rocket_warts.get(), husk_rocket_wartsEntity.prepareAttributes().build());

    }
}
